<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 交换两个变量
        var name1 = "易烊千玺";
        var name2 = "王一博";
        // 声明一个临时变量
        var temp;
        temp = name1;
        name1 = name2;
        name2 = temp;
        console.log(name1);
        console.log(name2);

        console.log("---------------------");
        var left = "苹果";
        var right = "橘子";
        console.log(left);
        console.log(right);
        // 声明一个临时变量桌子
        var table;
        // 左手的苹果放到桌子上
        table = left;
        // 右手的橘子放到左手里
        left = right;
        // 桌子上的苹果给右手
        right = table;
        console.log(left);
        console.log(right);

    </script>
</body>
</html>